package com.sp.scmdb.utils;

import java.util.List;
import java.util.Map;

import org.apache.commons.collections.CollectionUtils;

import com.google.common.collect.Maps;
import com.sp.scmdb.entity.Department;
import com.sp.scmdb.entity.Duty;
import com.sp.scmdb.entity.Shifts;
import com.sp.scmdb.entity.Title;
import com.sp.scmdb.entity.WorkTime;
import com.sp.scmdb.entity.WorkType;

public class EmpCollectionGroup {
	private Map<String, Department> depMap = null;
	private Map<String, Duty> dutyMap = null;
	private Map<String, Title> titleMap = null;
	private Map<String, WorkTime> workTimeMap = null;
	private Map<String, WorkTime> maxWorkTimeMap = null;
	private Map<String, Shifts> shiftsMap = null;
	private Map<String, WorkType> workTypeMap = null;

	public Map<String, Department> groupDep(List<Department> depList) {
		if (CollectionUtils.isNotEmpty(depList)) {
			depMap=Maps.newHashMap();
			for (Department department : depList) {
				depMap.put(department.getDeptName(), department);
			}
		}
		return depMap;
	}

	public Map<String, Duty> groupDuty(List<Duty> dutyList) {
		if (CollectionUtils.isNotEmpty(dutyList)) {
			dutyMap=Maps.newHashMap();
			for (Duty duty : dutyList) {
				dutyMap.put(duty.getName(), duty);
			}
		}
		return dutyMap;
	}

	public Map<String, Title> groupTitle(List<Title> titleList) {
		if (CollectionUtils.isNotEmpty(titleList)) {
			titleMap=Maps.newHashMap();
			for (Title title : titleList) {
				titleMap.put(title.getName(), title);
			}
		}
		return titleMap;
	}

	public Map<String, WorkTime> groupWorkTime(List<WorkTime> workTimeList) {
		if (CollectionUtils.isNotEmpty(workTimeList)) {
			workTimeMap=Maps.newHashMap();
			for (WorkTime workTime : workTimeList) {
				workTimeMap.put(workTime.getName(), workTime);
			}
		}
		return workTimeMap;
	}

	public Map<String, WorkTime> groupMaxWorkTime(List<WorkTime> maxWorkTimeList) {
		if (CollectionUtils.isNotEmpty(maxWorkTimeList)) {
			maxWorkTimeMap=Maps.newHashMap();
			for (WorkTime workTime : maxWorkTimeList) {
				maxWorkTimeMap.put(workTime.getName(), workTime);
			}
		}
		return maxWorkTimeMap;
	}

	public Map<String, Shifts> groupShifts(List<Shifts> shiftsList) {
		if (CollectionUtils.isNotEmpty(shiftsList)) {
			shiftsMap=Maps.newHashMap();
			for (Shifts shift : shiftsList) {
				shiftsMap.put(shift.getName(), shift);
			}
		}
		return shiftsMap;
	}

	public Map<String, WorkType> groupWorkType(List<WorkType> workTypeList) {
		if (CollectionUtils.isNotEmpty(workTypeList)) {
			workTypeMap=Maps.newHashMap();
			for (WorkType workType : workTypeList) {
				workTypeMap.put(workType.getName(), workType);
			}
		}
		return workTypeMap;
	}

	public Map<String, Department> getDepMap() {
		return depMap;
	}

	public Map<String, Duty> getDutyMap() {
		return dutyMap;
	}

	public Map<String, Title> getTitleMap() {
		return titleMap;
	}

	public Map<String, WorkTime> getWorkTimeMap() {
		return workTimeMap;
	}

	public Map<String, WorkTime> getMaxWorkTimeMap() {
		return maxWorkTimeMap;
	}

	public Map<String, Shifts> getShiftsMap() {
		return shiftsMap;
	}

	public Map<String, WorkType> getWorkTypeMap() {
		return workTypeMap;
	}

}
